#include "SettingWidget.h"

SettingWidget::SettingWidget(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);

	ui.lineIp->setInputMask("000.000.000.000");
}

SettingWidget::~SettingWidget()
{
}


void SettingWidget::setNo(int no)
{
	ui.labelNo->setText(QString::asprintf("%02d.", no));
}

QString SettingWidget::ip()
{
	return ui.lineIp->text();
}

void SettingWidget::setIp(QString ip)
{
	ui.lineIp->setText(ip);
}

QString SettingWidget::name()
{
	return ui.lineName->text();
}

void SettingWidget::setName(QString name)
{
	ui.lineName->setText(name);
}

bool SettingWidget::enable()
{
	return ui.boxEnable->isChecked();
}

void SettingWidget::setEnable(bool flag)
{
	ui.boxEnable->setChecked(flag);
}

ushort SettingWidget::addr()
{
	return (ushort)ui.lineAddr->value();
}

void SettingWidget::setAddr(ushort addr)
{
	ui.lineAddr->setValue(addr);
}

int SettingWidget::deviceType()
{
	return ui.boxType->currentIndex();
}

void SettingWidget::setDeviceType(int type)
{
	ui.boxType->setCurrentIndex(type);
}